﻿@using Newtonsoft.Json
@model BestQA.QueryService.DTOs.QuestionDTO
@{
    ViewBag.Title = "Details";
    var pageMode = (string)ViewBag.PageMode;
}
<div ng-controller="questionDetailController" ng-init="init(@JsonConvert.SerializeObject(Model), '@pageMode')" class="row question-page">
    <div class="col-md-9">
        <!-- 会在post-directive中被替换 -->
        <post content="question" type="question" question-state="{{questionState}}"
              save-callback="save()" scroll-to="scrollTo('question' + question.Id)" class=""></post>
        <!-- new answer -->
        <div class="new-answer" ng-if="pageMode == 'update'">
            <h4>Submit your answer</h4>
            <post content="{Body:'answer here'}" type="answer" save-callback="submitNewAnswer()"></post>
        </div>
    </div>
    @Html.Partial("~/Views/Shared/Sidebar.cshtml")
</div>
@section Scripts
{
    <script type="text/javascript" src="@Url.Content("~/Scripts/app/directives/post-directive.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/app/directives/angular-pagedown.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/app/services/questionService.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/app/controllers/questionDetailController.js")"></script>
}